#include <EXTERN.h>
#include <perl.h>

int main(int argc, char** argv, char** env) {
   static PerlInterpreter *my_perl;
   char *switches[] = {"", "-MConfig", "-e", "0"};
   HV* config;
   SV** osname;
 

   my_perl = perl_alloc();
   perl_construct(my_perl);
   perl_parse(my_perl, NULL, 4, switches, (char**)NULL);
   perl_run(my_perl);

   config = get_hv("Config", 0);
   osname = hv_fetch(config, "osname", 6, 0);
   if(NULL != osname) {
      printf("$Config{osname} = '%s'\n", SvPV(*osname, PL_na));
   }

   perl_destruct(my_perl);
   perl_free(my_perl);
}
